package sphere.controller;

import java.awt.*;
import java.awt.event.TextEvent;
import java.awt.event.TextListener;

import sphere.model.Sphere;
import sphere.view.SphereWindow;

public class SphereController implements TextListener {

	public SphereWindow vuesphere;
	public Sphere modelsphere;

	public SphereController(SphereWindow v) {
		this.vuesphere = v;
		modelsphere = new Sphere();
	}

	@Override
	public void textValueChanged(TextEvent e) {

		modelsphere.setRayon(Double.parseDouble(vuesphere.getAfficher()));
		vuesphere.setVolume(String.valueOf(modelsphere.calculerVolume()));
		vuesphere.setSurface(String.valueOf(modelsphere.calculerSurface()));

	}

}
